#include <gnome.h>

gboolean delete_handle(GtkWidget *self,GdkEvent *event,gpointer data){
	static gint count = 0;
	g_print("Attempt number %d\n",++count);
	if(count>2) return FALSE;
	return TRUE;
}

gboolean destroy_handle(GtkWidget *self,GdkEvent *event,gpointer data){
	g_print("Shutting down\n");
	gtk_main_quit();
	return FALSE;
}

int main(int argc,char **argv){
	GtkWidget *w;
	gtk_init(&argc,&argv);
	w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_signal_connect(GTK_OBJECT(w),"delete_event",G_CALLBACK(delete_handle),NULL);
	gtk_signal_connect(GTK_OBJECT(w),"destroy",G_CALLBACK(destroy_handle),NULL);
	gtk_widget_show_all(w);
	gtk_main();
	return 0;
}